package com.gitee.wsl.android.ext.okhttp.intercept.store

import android.content.Context
import com.gitee.wsl.android.ext.ApplicationInit.application
import com.gitee.wsl.jvm.okhttp.OkHttpClientScope
import com.gitee.wsl.jvm.okhttp.intercept.store.CookieInterceptor

fun OkHttpClientScope.ableAndroidCookie(){
    getBuilder().addInterceptor(CookieInterceptor(AndroidCookieJar.instant))
}

fun OkHttpClientScope.ableAndroidDbCookie(context: Context = application,
                                           dbName: String = "net_cookies"){
    getBuilder().addInterceptor(CookieInterceptor(PersistentCookieJar(context, dbName)))
}